<HTML>
	<HEAD>
		<link rel="stylesheet" type="text/css" href="<?=$base?>bud/css/jquery.treeview.css" />
		<link rel="stylesheet" type="text/css" href="<?=$base?>bud/css/screen.css" />
		<script type="text/javascript" src="<?=$base?>bud/css/jquery.js" ></script>
		<script type="text/javascript" src="<?=$base?>bud/css/jquery.cookie.js"></script>
		<script type="text/javascript" src="<?=$base?>bud/css/jquery.treeview.js"></script>	
		<script type="text/javascript" src="<?=$base?>bud/css/demo.js"></script>
		</script>
	</HEAD>
<BODY>
	
	<?php
		function convert($val){
			if($val>=1){
				return ("<IMG SRC=\"".base_url()."images/icons/fugue/tick.png\">");
			}else{
				return ("<IMG SRC=\"".base_url()."images/icons/fugue/minus.png\">");
			}
		}

		
	?>
	<H2>Budget versi : <?=$versi;?></H2>
	Total : Rp. <?=number_format($content['total'],2,',','.')?>
	<HR>
	<ul id="red" class="treeview-red">
		<ul>
			
			<h3>KPU</h3>
			<?php foreach($content['element'] as $keykpu=>$valkpu):?>
				<li><span><B><?=$keykpu?><BR></B></span>
				<?php if(is_array($content['element'][$keykpu]['element'])):?>
					<FONT size='2'><?=$content['element'][$keykpu]['total']?"Total : Rp. ".number_format($content['element'][$keykpu]['total'],2,',','.'):'';?></FONT>
					<ul>
					<h3>PU</h3>
					<?php foreach($content['element'][$keykpu]['element'] as $keypu=>$valpu):?>	
						<li><span><B><?=$keypu?><BR></B></span>
						<?php if(is_array($content['element'][$keykpu]['element'][$keypu]['element'])):?>
							<FONT size='2'><?=$content['element'][$keykpu]['element'][$keypu]['total']?"Total : Rp. ".number_format($content['element'][$keykpu]['element'][$keypu]['total'],2,',','.'):'';?></FONT>
							<ul>
								<h3>Program</h3>
								<?php foreach($content['element'][$keykpu]['element'][$keypu]['element'] as $keyprog=>$valprog):?>
									<li><span><B><?=$keyprog?><BR></B></span>
										<?php if(is_array($content['element'][$keykpu]['element'][$keypu]['element'][$keyprog]['element'])):?>
											<FONT size='2'><?=$content['element'][$keykpu]['element'][$keypu]['element'][$keyprog]['total']?"Total : Rp. ".number_format($content['element'][$keykpu]['element'][$keypu]['element'][$keyprog]['total'],2,',','.'):'';?></FONT>
											<ul>
											<h3>Activity</h3>
											<?php foreach($content['element'][$keykpu]['element'][$keypu]['element'][$keyprog]['element'] as $keyact=>$valact):?>
												<li><span><?=$keyact?></span><BR>
													<ul>
														<I><?=$valact->desc_activity?></I>
														<hr>
														<?php
															 
															$table_mark = new MY_Table();
															
															//Set Template

															$templ_detail = array(
																'table_open' => '<table border= "1" height="300" width="500" class="table">',
																'table_close' => '</table>',
															);
															$templ_mark = array(
																'table_open' => '<table border= "1" height="300" width="300" class="table">',
																'table_close' => '</table>'
															);

															//$valact->gaji_honor+$valact->barang_tak_habis+$valact->barang_habis+$valact->jasa_honor_ext+$valact->perjalanan
															//Detail
															$detail_element = array (		
																  '<B>Total</B>'=>($valact->total),
																  '--Gaji'=>$valact->gaji_honor,
																  '--Barang Habis'=>$valact->barang_habis,
																  '--Barang Tak Habis'=>$valact->barang_tak_habis,
																  '--Perjalanan'=>$valact->perjalanan,
																  '--Jasa Lain'=>$valact->jasa_honor_ext,
																  'Volume'=>$valact->volume,
																  'Sumber'=>$valact->key_bud_r_sumber,
																  'Unit'=>$valact->key_bud_r_unit,
																  'Aktivitas Yayasan'=>$valact->key_bud_m_yayasan_activity,
																  'Program'=>$valact->key_bud_m_program,
															);
															$mark_element = array (
																	'Januari'=>convert($valact->januari),
																	'Februari'=>convert($valact->februari),
																	'Maret'=>convert($valact->maret),
																	'April'=>convert($valact->april),
																	'Mei'=>convert($valact->mei),
																	'Juni'=>convert($valact->juni),
																	'Juli'=>convert($valact->juli),
																	'Agustus'=>convert($valact->agustus),
																	'September'=>convert($valact->september),
																	'Oktober'=>convert($valact->oktober),
																	'November'=>convert($valact->november),
																	'Desember'=>convert($valact->desember)			
															);

															

															//Mark
															$table_mark->set_template($templ_mark);				
															//$table_mark->set_heading('Penggunaan Budget','');
															
															foreach($mark_element as $key=>$val){
																$table_mark->add_row('<FONT size="2">'.$key.'</FONT>','<FONT size="2">'.$val.'</FONT>');
															}
																				
														?>
														
														<TABLE border= "4" height="200" width="800" class="table">
															<TR>
																<TD colspan='2' align="CENTER">
																	<FONT size="3"><B>Detail Budget</B></FONT>
																</TD>
															</TR>
															<TR>
																<TD><?
																	echo '<table border= "1" height="300" width="500" class="table">';
																	$i=0;
																	foreach($detail_element as $key=>$vals){
																		$i++;
																		if($i % 2 == 1){
																			if($i > 6){
																				echo '<TR><TD><FONT size="2">'.$key.'</FONT></TD><TD align="right"><FONT size="2">'.$vals.'</FONT></TD></TR>';
																			}else{
																				echo '<TR><TD><FONT size="2">'.$key.'</FONT></TD><TD align="right"><FONT size="2">Rp. '.number_format($vals,2,',','.').'</FONT></TD></TR>';
																			}
																		}else{
																			if($i > 6){
																				echo '<TR class="alternate"><TD><FONT size="2">'.$key.'</FONT></TD><TD align="right"><FONT size="2">'.$vals.'</FONT></TD></TR>';
																			}else{
																				echo '<TR class="alternate"><TD><FONT size="2">'.$key.'</FONT></TD><TD align="right"><FONT size="2">Rp. '.number_format($vals,2,',','.').'</FONT></TD></TR>';
																			}
																		}
																	}
																	echo '</table>';
																	?>
																</TD>
																<TD>
																	<?=$table_mark->generate();?>
																</TD>
															</TR>
														</TABLE>	

														<?php
															
															$table_mark->clear();
														?>
													</ul>
												</li>
											<?php endforeach;?>
											</ul>
										<?php endif;?>
									</li>
								<?php endforeach;?>
							</ul>
						<?php endif;?>
						</li>
					<?php endforeach;?>
					</ul>
				<?php endif;?>
				</li>
			<?php endforeach;?>
		</ul>
	</BODY>
</HTML>